import cv2
import matplotlib.pyplot as plt
image = cv2.imread('7.png')
hist = cv2.calcHist([image],[0],None,[256],[0,255])
plt.plot(hist)
plt.show()